<template>
  <div class="content-view">
    <div class="table-head-tool">

    </div>
    <div class="table-body">
      <tables ref="tables" v-model="gridOption.data" :columns="gridOption.columns" :pageOption="gridOption.param.pageOption" @changePage="query" />
    </div>
  </div>
</template>
<script>
import uiTool from '@/libs/uiTool'
import sys_log_serve from '@/api/system/sys_log_serve'

export default {
  name: 'tables_page',

  data() {
    return {
      gridOption: {
        param: {
          pageOption: {
            total: 0,
            page: 1,
            pageSize: 20,
          },
        },
        columns: [
          { title: 'id', key: 'id', width: 80 },
          { title: '表', key: 'table_name', width: 180 },
          { title: '操作', key: 'operate', width: 120 },
          {
            title: '内容',
            key: 'content',
            render(h, params) {
              return h('div', {
                style: {
                  'text-align': 'left',
                  padding: '15px',
                },
                domProps: { innerHTML: params.row.content },
              })
            },
          },
          { title: '创建时间', key: 'created_date', width: 180 },
        ],
        data: [],
      },
      treeData: [],
    }
  },
  created() {
    this.init()
  },
  methods: {
    async init() {
      this.query(1)
    },
    async query(page) {
      if (page) {
        this.gridOption.param.pageOption.page = page
      }
      let res = await sys_log_serve.operates(this.gridOption.param)
      this.gridOption.data = res.data.rows
      this.gridOption.param.pageOption.total = res.data.count
    },
  },
}
</script>
